MessengerAccount

A concrete account configuration for connecting to a Genesys Cloud Messenger deployment.

MessengerAccount encapsulates all the configuration needed to establish a chat session, including the deployment identifier, domain, authentication credentials, and custom attributes.

Usage:

val account = MessengerAccount(
deploymentId = "your-deployment-id",
domain = "your-domain",
context = applicationContext, // required for journey context / tracking
).apply {
logging = true
sessionExpirationNoticeInterval = 300
}

// Optionally configure authentication
account.setAuthenticationInfo(
authCode = authorizationCode,
redirectUri = "myapp://callback",
codeVerifier = pkceVerifier
)

// Optionally initiate Mobile Tracking (requires Context above)
account.initiateTracking(
TrackingConfig(
appName = "MyApp",
appNamespace = "com.example.app",
appVersion = "1.0.0",
appBuildNumber = "1",
deviceCategory = DeviceCategory.MOBILE,
deviceType = "phone",
osFamily = "Android",
osVersion = "14",
)
)

val chatController = ChatController.Builder(context)
.chatEventListener(this)
.build(account, chatLoadedListener)

Important: The deploymentId and domain must match a valid Genesys Cloud Messenger deployment. An incorrect configuration will result in connection errors.

Constructors

Link copied to clipboard
constructor(deploymentId: String, domain: String, context: Context? = null)

Creates a new Messenger account with the specified deployment configuration.

Properties

Link copied to clipboard

The current authorization code authentication info, or null if not configured.

Link copied to clipboard

Custom attributes associated with the chat session.

Link copied to clipboard

Deployment identifier, containing configuration and routing information for the Genesys Cloud Messenger deployment this account connects to.

Link copied to clipboard

The domain of the Genesys Cloud region this account connects to.

Link copied to clipboard

true when implicit authentication was configured via setImplicitAuthenticationInfo.

Link copied to clipboard
val journeyContextProvider: () -> JourneyContextInfo?

Provider consumed by the transport at session configure. Returns a JourneyContextInfo carrying the device cookie (when a Context was supplied) and the journey session id (when a tracking session exists). Returns null - so the journey context is omitted - when no cookie provider is available.

Link copied to clipboard

When true, enables SDK info and debug logging to the console. Defaults to false.

Link copied to clipboard

Session expiration notice interval in seconds. Specifies how many seconds before session expiration the SDK should display a notice. Defaults to 300 seconds (5 minutes) if not set.

Link copied to clipboard

The active Mobile Tracking adapter, or null if tracking has not been initiated.

Functions

Link copied to clipboard

Attaches (or replaces) a Mobile Tracking adapter to this account. No network calls are made until the first event is fired. May be called any time after construction.

Link copied to clipboard

Host-controlled reset of the tracked visitor: clears the customer identifiers (external id and traits) and the journey session id on the active tracker, and rotates the device cookie used to identify the user. The tracker instance itself is preserved. Clearing identifiers is a no-op when tracking has not been initiated, but the device cookie is rotated regardless.

Link copied to clipboard
fun setAuthenticationInfo(authCode: String, redirectUri: String, codeVerifier: String?)

Configures authorization code authentication for the chat session.

Link copied to clipboard

Configures implicit (ID token) authentication for the chat session.